package helper;

import java.util.ArrayList;
import java.util.List;

import entity.CourseScore;
import entity.Department;
import entity.PersonInfo;
import entity.Student;
import enums.DepartmentType;

public class CreateStudent {

	public Student autoGenerate(String sid, String name, String gender){
		return new Student(getInfo(name, gender), "2013-08-31", sid, getGrades(), 4.3);
	}
	
// 	生成个人信息	
	private PersonInfo getInfo(String name, String gender) {
		Department department = new Department("1250", "软件学院", DepartmentType.院系.toString());
		return new PersonInfo(name, gender, department, "1995-01-01", "000111222333444555");
	}
	
	
//	随机生成五门课的分数
	private List<CourseScore> getGrades(){
		List<CourseScore> grades = new ArrayList<>();
		int grades_general, grades_final, grades_overall;
		
		for(int i = 0; i<5; i++) {
			grades_general = (int) (Math.random()*100);
			grades_final = (int) (Math.random()*100);
			grades_overall = (int) (grades_general*0.4 + grades_final*0.6);
			grades.add(new CourseScore("C102"+i, "coursename_"+i, grades_general, grades_final, grades_overall));
		}
		
		return grades;
	}

}
